﻿using System;
using System.Collections.Generic;
using System.Text;
using Watchdog.Dal;
using Watchdog.Bll;
using Watchdog.Bll.Base;

namespace Watchdog.Bll.Factory {

    public partial class TestFactory {
        public static void AddNotification ( Test test, Notification notification ) {
			Dal.DataClient.Current.TestAddNotification (test.IntData, notification.IntData );
		}
        public static void Delete ( TestBase test ) {
            DataClient.Current.TestDelete ( test.IntData );
        }

        public static List<Test> GetByDefinition ( int definition ) {
		    List<Test> outlist = new List<Test> ();
            Watchdog.Facade.Test[] list = Dal.DataClient.Current.TestGetByDefinition ( definition );
            foreach (Watchdog.Facade.Test item in list)
                outlist.Add (new Test (item));
            return outlist;
            // return DataClient.Current.TestGetByDefinition ( definition );
        }
        public static Test GetById ( int id ) {
            return new Test (DataClient.Current.TestGetById (id));
        }
				
        public static List<Test> GetByNotification ( int notification ) {
		    List<Test> outlist = new List<Test> ();
            Watchdog.Facade.Test[] list = Dal.DataClient.Current.TestGetByNotification ( notification );
            foreach (Watchdog.Facade.Test item in list)
                outlist.Add (new Test (item));
            return outlist;
            // return DataClient.Current.TestGetByNotification ( notification );
        }
        public static void Insert ( TestBase test ) {
            test.IntData = DataClient.Current.TestInsert ( test.IntData );
        }

        public static void RemoveNotification ( Test test, Notification notification ) {
			Dal.DataClient.Current.TestRemoveNotification (test.IntData, notification.IntData );
		}
        public static void Update ( TestBase test ) {
            DataClient.Current.TestUpdate ( test.IntData );
        }
		
	}
}
